﻿using Blog.Domain;
using Core.Repository.Where;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Blog.Application.Condition
{
   public class GalleryCondition:PageCondition
    {
        /// <summary>
        /// 标签匹配查询
        /// </summary>
        public string LableContain;
        /// <summary>
        /// 描述匹配查询
        /// </summary>
        public string DescriptionContain;
        public Expression<Func<Gallery, bool>> BuildExpression()
        {
            ParseCondition<Gallery> parse = new ParseCondition<Gallery>();
            if (!string.IsNullOrEmpty(LableContain))
                parse.BuildExpression("Lable", LableContain, ConditionOperation.Contains);
            if (!string.IsNullOrEmpty(DescriptionContain))
                parse.BuildExpression("Description", DescriptionContain, ConditionOperation.Contains);
            return parse.BuildWhereExpression(); 
        }
    }
}
